<?php
  defined('_JEXEC') or die();
  jimport('joomla.application.component.model');
  require_once('base.php');
  
  class PersonModelPerson extends BaseModel
  {     
    var $_name        = "person";
    var $_table       = "#__pbny_persons";
    
    function get_fullname($id){
      
      $tmp_result = $this->get($id);
      return $tmp_result->lastname.', '.$tmp_result->firstname;
    }
    
    function get_person_by_user_id($user_id){
      $sql = 'SELECT * '.
             'FROM '.$this->_table.
             ' WHERE user_id='.$user_id;
      return $this->_get($sql, true);
    }
	
	function get_fullnames(){
	  $sql = 'SELECT id,lastname,firstname '.
	         'FROM '.$this->_table.
			 ' ORDER BY lastname';
	  return $this->_get($sql);
	}
	
  }
?>